package com.dong.curator.checkConfig;

import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.RetryNTimes;

/**
 * @author: dzj
 * @date 2018/10/11-13:35
 */
public class CuratorAcl {
    public CuratorFramework client  = null;
    public static final String zkServerPath = "10.0.109.142:2181";

    public CuratorAcl() {
        RetryPolicy rp = new RetryNTimes(3,5000);
        client=CuratorFrameworkFactory
                .builder()
                .retryPolicy(rp)
                .connectString(zkServerPath)
                .sessionTimeoutMs(15000)
                .namespace("workspace")
                .build();
        client.start();
    }
    public void closeZkClient() {
        if(client!=null) {
            client.close();
        }
    }

    public static void main(String[] args) {


    }
}
